package org.spark.api.utils

import org.apache.spark.rdd.RDD
import org.apache.spark.sql.{Row, SparkSession}
import org.apache.spark.sql.types.StructType

object CsvExportUtil {


  def export(spark: SparkSession, path: String, rdd: RDD[Row], schema: StructType): Unit = {
    val df = spark.createDataFrame(rdd, schema)
    df.write.format("csv").mode("overwrite").option("header", true).save(path)
  }


}
